<html>
<head><meta charset="utf-8"><title>DefId to Res? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20to.20Res.3F.html">DefId to Res?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243329976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20to%20Res%3F/near/243329976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20to.20Res.3F.html#243329976">(Jun 21 2021 at 00:50)</a>:</h4>
<p>Is there a pre-existing function to convert DefIds to a Res? Someone just wrote a new one in a rustdoc PR and I'd rather use the compiler's APIs where possible. <a href="https://github.com/rust-lang/rust/pull/86334">https://github.com/rust-lang/rust/pull/86334</a></p>



<a name="243378338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20to%20Res%3F/near/243378338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20to.20Res.3F.html#243378338">(Jun 21 2021 at 13:03)</a>:</h4>
<p>It's <code>Res::Def(tcx.def_kind(def_id), def_id)</code> (which the linked PR already uses), all the <code>Res::Primitive</code> stuff is either impossible or rustdoc-specific.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>